<extend name="Public/base" />

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>{$meta_title}</h2>
    </div>
    <div class="cf">
        <div class="fl">
            <a class="btn" href="{:U('add')}">新 增</a>
            <button class="btn ajax-post confirm" url="{:U('delete')}" target-form="ids">删 除</button>
        </div>

        <!-- 高级搜索 -->
        <div class="search-form fr cf">
            <div class="sleft">
                <select name="status" id="status">
                    <option value="0" >==全部==</option>
                    <volist name="_status" id="vo">
                    <option value="{$i}" <php>if($i==I("status"))echo 'selected="selected"';</php>>{$vo}</option>
                    </volist>
                </select>
            </div>
            <div class="sleft">
                <input type="text" name="name" class="search-input" value="{:I('name')}" placeholder="请输入姓名">
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a>
            </div>
        </div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
        <table class="">
            <thead>
            <tr>
                <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
                <th class="">编号</th>
                <th class="" style="width: 56px;">姓名</th>
                <th class="" style="width: 28px;">性别</th>
                <th class="" style="width: 80px;">生日</th>
                <th class="">地址</th>
                <th class="" style=" width: 56px;">家长姓名</th>
                <th class="" style="width: 92px;">家长电话</th>
                <th class="" style="width: 44px;">状态</th>
                <th class="">备注</th>
                <th class="" style="width: 28px;">来源</th>
                <th class="" style="width: 56px;">介绍人</th>
                <th class="" style="width: 120px;">录入时间</th>
                <th class="" style="width: 125px;">操作</th>
            </tr>
            </thead>
            <tbody>
            <notempty name="_list">
                <volist name="_list" id="vo">
                    <tr>
                        <td><input class="ids" type="checkbox" name="id[]" value="{$vo.id}" /></td>
                        <td>{$vo.noid}</td>
                        <td>{$vo.name}</td>
                        <td>
                            <switch name="vo.sex">
                                <case value="1">男</case>
                                <case value="2">女</case>
                                <default />未知
                            </switch>
                        </td>
                        <td>{:time_format($vo['birthday'],'Y-m-d')}</td>
                        <td title="{$vo.address}">{$vo.address|_msubstr}</td>
                        <td>{$vo.parent_name}</td>
                        <td>{$vo.parent_phone}</td>
                        <td>
                            <switch name="vo.status">
                                <case value="1">待确认</case>
                                <case value="2">已确认</case>
                                <case value="3">已签约</case>
                                <default />未知
                            </switch>
                        </td>
                        <td>{$vo.remark}</td>
                        <td>
                            <switch name="vo.source">
                                <case value="1">自然</case>
                                <case value="2">介绍</case>
                                <default />未知
                            </switch>
                        </td>
                        <td>{$vo.introducer_id|_getIntroducer}</td>
                        <td><span>{$vo.create_time|time_format}</span></td>
                        <td>
                            <a href="{:U('Visit/index?sid='.$vo['id'])}" class="authorize">来访</a>
                            <a href="{:U('Learn/index?sid='.$vo['id'])}" class="authorize">评估</a>
                            <a href="{:U('add?id='.$vo['id'])}" class="authorize">编辑</a>
                            <a href="{:U('delete?id='.$vo['id'])}" class="confirm ajax-get">删除</a>
                        </td>
                    </tr>
                </volist>
                <else/>
                <td colspan="14" class="text-center"> aOh! 暂时还没有内容! </td>
            </notempty>
            </tbody>
        </table>
    </div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">
        //搜索功能
        $("#search").click(function(){
            var url = $(this).attr('url');
            var query  = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            if( url.indexOf('?')>0 ){
                url += '&' + query;
            }else{
                url += '?' + query;
            }

            var status = $("#status").val();
            window.location.href = url + '&status='+status;
        });
        //回车搜索
        $(".search-input").keyup(function(e){
            if(e.keyCode === 13){
                $("#search").click();
                return false;
            }
        });
        //导航高亮
        highlight_subnav('{:U('Student/index')}');
    </script>
</block>
